package team.seekers.hula.teamwork.teamTodo.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.teamwork.teamTodo.entity.dto.TeamTodoAddDTO;
import team.seekers.hula.teamwork.teamTodo.entity.dto.TeamTodoParticipantAddDTO;
import team.seekers.hula.teamwork.teamTodo.entity.dto.TeamTodoParticipantUpdateDTO;
import team.seekers.hula.teamwork.teamTodo.entity.dto.TeamTodoUpdateDTO;
import team.seekers.hula.teamwork.teamTodo.entity.vo.TeamTodoListVO;
import team.seekers.hula.teamwork.teamTodo.entity.vo.TeamTodoManageInfoVO;
import team.seekers.hula.teamwork.teamTodo.service.TeamTodoService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 团队todo
 * @author hbc
 * @since 2023-01-05
 */

@Controller
@ApiResponseBody
@RequestMapping("/team-todo")
public class TeamTodoController {

    @Resource
    private TeamTodoService teamTodoService;

    @ApiOperation(value = "获取团队待办详细信息")
    @GetMapping("/info")
    public TeamTodoManageInfoVO info(@RequestParam String id) {
        return teamTodoService.info(id);
    }

    @ApiOperation(value = "发布团队任务")
    @PostMapping("/add")
    public TeamTodoManageInfoVO addTeam(@RequestBody TeamTodoAddDTO teamTodoAddDTO) {
        return teamTodoService.add(teamTodoAddDTO);
    }

    @ApiOperation(value = "编辑团队待办")
    @PostMapping("/update")
    public void update(@RequestBody TeamTodoUpdateDTO teamTodoUpdateDTO) {
        teamTodoService.update(teamTodoUpdateDTO);
    }

    @ApiOperation(value = "修改团队待办的共创者待办")
    @PostMapping("/update-participant")
    public void updateParticipant(@RequestBody TeamTodoParticipantUpdateDTO teamTodoUpdateDTO) {
        teamTodoService.updateParticipant(teamTodoUpdateDTO);
    }

    @ApiOperation(value = "修改团队待办的共创者待办")
    @PostMapping("/add-participant")
    public String addParticipant(@RequestBody TeamTodoParticipantAddDTO participantAddDTO) {
        return teamTodoService.addParticipant(participantAddDTO);
    }

    @ApiOperation(value = "删除团队待办")
    @GetMapping("/delete")
    public void delete(@RequestParam String id) {
        teamTodoService.delete(id);
    }

    @ApiOperation(value = "渲染团队待办")
    @GetMapping("/list")
    public List<TeamTodoListVO>  teamTodoList(@RequestParam String teamId) {
        return teamTodoService.teamTodoList(teamId);
    }


    @ApiOperation(value = "团队待办即将截止，向成员发送消息")
    @GetMapping("/message")
    public void message(@RequestParam String todoId) {

    }

}

